package com.luboyan.CBillbill.service.user.auth.impl;

import com.luboyan.CBillbill.mapper.user.auth.UserRoleMapper;
import com.luboyan.CBillbill.dao.user.auth.UserRole;
import com.luboyan.CBillbill.service.user.auth.UserRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 用户对应角色业务逻辑
 */
@Service
public class UserRoleServiceImpl implements UserRoleService {

    @Autowired
    private UserRoleMapper userRoleMapper;

    /**
     * 通过userId查询用户绑定的所有角色
     */
    @Override
    public List<UserRole> getUserRoleByUserId(Long userId) {

        return userRoleMapper.getUserRoleByUserId(userId);
    }

    /**
     * 添加用户角色
     */
    @Override
    public void addUserRole(UserRole userRole) {

        userRoleMapper.insert(userRole);
    }
}
